package io.fun.jfinal.model;

import org.fun.jfinal.common.StringUtils;
import org.fun.jfinal.model.core.JModel;
import org.fun.jfinal.model.core.Table;

@Table(tableName = "sys_user",  primaryKey= "userid")
public class SysUser extends JModel<SysUser> {

	private static final long serialVersionUID = 1L;
	public static final SysUser dao = new SysUser();
	
	public Integer getUserid() {
		return getInt("userid") == null ? -1 : getInt("userid");
	}
	
	public String getUserName() {
		if (StringUtils.isNotEmpty(getStr("realname"))) {
			return getStr("realname");	
		}
		return getStr("username");
	}
}
